#include "s3e.h"
#include "Iw2D.h"
#include <list>
#include <vector>
#include "ui_menu.h"
#include "ui_page.h"
#include "ui_widgets.h"
#include "engine.h"
#include "game.h"
#include "buttonfunctions.h"

void btnFunction_GoToGame( UI::Widget* a_Widget )
{
	Engine::GetSingletonPtr()->SwitchEngineState(Engine::GAME);
}

void btnFunction_GoToOptions( UI::Widget* a_Widget )
{
	a_Widget->GetParentMenu()->SetPage("MainMenu_Options");
}

void btnFunction_GoToCredits( UI::Widget* a_Widget )
{
	a_Widget->GetParentMenu()->SetPage("MainMenu_Credits");
}

void btnFunction_GoToGeneral( UI::Widget* a_Widget )
{
	a_Widget->GetParentMenu()->SetPage("MainMenu_General");
}

void btnFunction_ApplyOptions( UI::Widget* a_Widget )
{
	// Store/set selected options.
	Engine::GetSingletonPtr()->UpdateMusicVolume();
}

void btnFunction_ApplyVolume( UI::Widget* a_Widget )
{
	Engine::GetSingletonPtr()->UpdateMusicVolume();
}

void btnFunction_GoToHelp( UI::Widget* a_Widget )
{
	a_Widget->GetParentMenu()->SetPage("PauseMenu_Help");
}

void btnFunction_GoToGeneralPause( UI::Widget* a_Widget )
{
	a_Widget->GetParentMenu()->SetPage("PauseMenu_General");
}

void btnFunction_ResumeGame( UI::Widget* a_Widget )
{
	// Tell game object to switch state.
	Game::GetSingletonPtr()->SwitchGameState(Game::NORMAL);
}

void btnFunction_PauseGame( UI::Widget* a_Widget )
{
	// Tell game object to switch state.
	Game::GetSingletonPtr()->SwitchGameState(Game::PAUSED);
}

void btnFunction_QuitGame( UI::Widget* a_Widget )
{
	// Quit.
	Engine::GetSingletonPtr()->SwitchEngineState(Engine::MAINMENU);
}

void btnFunction_RestartGame( UI::Widget* a_Widget )
{
	// Restart.
	Game::GetSingletonPtr()->Restart();
}

void btnFunction_ResetScores( UI::Widget* a_Widget )
{
	Engine::GetSingletonPtr()->SetHighscore(0);
}

void btnFunction_GoToGameOptions( UI::Widget* a_Widget )
{
	a_Widget->GetParentMenu()->SetPage("PauseMenu_Options");
}

void btnFunction_EndApplication( UI::Widget* a_Widget )
{
	Engine::GetSingletonPtr()->SwitchEngineState(Engine::EXIT);
}